﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Guedes_Library;
using System.Data;

/// <summary>
/// Summary description for ProdutoGrupoModal
/// </summary>
public class ProdutoGrupoModal:GuedesModel<product>
{
	public ProdutoGrupoModal()
	{
		//
		// TODO: Add constructor logic here
		//
	}


    public List<product> getAll()
    {

        return SelectAll();
    }


    public override void DoChanges(product entity, product novo)
    {
        entity.ID_Cat = novo.ID_Cat;
        entity.Image = novo.Image;
        entity.Name = novo.Name;
        entity.Desc = novo.Desc;
    }



    public byproduct getProdutoByCategoria(int id)
    {
        using (guedesEntities context = new guedesEntities())
        {
            var produc =
                from p in context.byproduct
                where p.ID_Prod == id
                select p;
                return produc.FirstOrDefault();
        }
    }

    public override string GetTabela()
    {
        return "guedesEntities.product";
    }

    public override string GetKeyTabela()
    {
        return "ID";
    }
}